package cn.com.dhc.danlu.widget.home;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;

/**
 * User: Geek_Soledad(wuhaiyang@danlu.com)
 * Date: 2016-08-17
 * Time: 16:05
 * Description: 首页的丹露促销、丹露推荐用ListView
 */
public class HomeListView extends LinearLayout {

    public HomeListView(Context context) {
        this(context, null);
    }

    public HomeListView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public HomeListView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setOrientation(VERTICAL);
    }

    public void refreshView(BaseAdapter adapter) {
        removeAllViews();
        for (int i = 0; i < adapter.getCount(); i++) {
            View view = adapter.getView(i, null, this);
            addView(view);
        }
    }
}
